# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>

pkgname=libsonic
pkgver=0.2.0
pkgrel=1
pkgdesc="Simple library to speed up or slow down speech"
arch=('loong64' 'x86_64')
url="https://github.com/waywardgeek/sonic"
license=('Apache')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/waywardgeek/sonic/archive/refs/tags/release-${pkgver}.tar.gz"
        "ldflags.patch")
sha512sums=('e70510c89c4f29c30f2a3443a1c4fc1aab2c99147e2ebd1dea3cbb2b89b8bdcee14dc504600ac1f04e82d32c19f17b06fbb417311853beb764c24d15687a126f'
            '751ec8bca373028fe6aa02f3557116369e588148755ab26e210d6bc0b4a70aecdf8b67aae9d7ba934f2eb14ab418f3a1d2854061ee6efd7d35cead4c5858ad36')
b2sums=('c4a45291e87bfaa36b7ee248b0f6af148d7c90a6e1efaf4e7d99b86ff987817ff49dc55aa2fb41151ea7facbd87858fc6b40818a776babdbc228f2f2406a616d'
        '8b38fb56ae16548df62f7a75c6f784b0139a96202fc237d03d342ea7f2427ef70e765ffce620b127b7059cab32ea169f0ebb08eb529b0b276df88d9eb0f75e2a')

prepare() {
  cd sonic-release-${pkgver}
  patch -N -i ../ldflags.patch
}

build() {
  cd sonic-release-${pkgver}
  make
}

package() {
  cd sonic-release-${pkgver}
  make DESTDIR="$pkgdir/" install
  rm -v "$pkgdir/usr/lib/libsonic.a"
  install -vDm644 sonic.1 -t "$pkgdir/usr/share/man/man1/"
}
